<?
if (empty($ID))
{
	$formaction="/lvs/Monitors_do_add";
	$formbutton="增加";
	$ID="";
}
else
{
	$formaction="/lvs/Monitors_do_edit";
	$formbutton="修改";
}
if (empty($monitors_name))
	$monitors_name="";
if (empty($monitors_type))
	$monitors_type="TCP_CHECK";
if (empty($monitors_par1))
	$monitors_par1="";
if (empty($monitors_par2))
	$monitors_par2="";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>" />
<title><?=$title?></title>
<meta  name="keywords" content="<?=$keywords?> " />
<meta  name="description" content="<?=$description?>"/>	

<!-- CSS -->
<link href="/style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="/style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="/style/css/ie7.css" /><![endif]-->

<!-- JavaScripts-->
<script type="text/javascript" src="/style/js/jquery.js"></script>
<script type="text/javascript" src="/style/js/jNice.js"></script>
<script language="javascript" src="/js/prototype.js"></script>
<script language="javascript" src="/js/javafunc.js"></script>
<script language="javascript">
    function showdiv(){
	document.getElementById("divform").style.display="";
    }
    
    function hiddendiv(){
	document.getElementById("divform").style.display="none";
    }
    
    function SetParename()
    {
	var monitors_type = $F('monitors_type');
        var url = '/lvs/Monitors_parname/'+monitors_type;
	if (monitors_type=="HTTP_GET" || monitors_type=="SSL_GET")
		document.getElementById("partables3").innerHTML="<input type='button' value='计算工具' onclick=\"showdiv();\">";
	else
	{
		document.getElementById("partables3").innerHTML="";
		hiddendiv()
	}
	var myAjax = new Ajax.Request(
                    url,
                    {method: 'get', onComplete: showResponse}
                    );
    }

    function showResponse(originalRequest)
    {
	eval("var strReq = " + originalRequest.responseText);
	document.getElementById("partables1").innerHTML=strReq["Monitors"][0]["par1"]
	document.getElementById("partables2").innerHTML=strReq["Monitors"][0]["par2"]
    }
    
    function getdigest()
    {
	var ip = $F('ip');
	var path = $F('path');
	if ((ip=="") || (path==""))
	{
		alert("ip or path no null!");
		return false;
	}
	var pars = 'ip='+ip+'&path='+path;
        var url = '/lvs/Monitors_digest';
	var myAjax = new Ajax.Updater(
	'digestdiv',
	url,
        {method: 'get',parameters: pars}
        );
    }
    
</script>
</head>

<body onLoad="SetParename();">
<div id="systemWorking" style="z-index:100; position:absolute;display:none;left:40%;top:40%"><table width="250" height="20" border="0" cellpadding="0" cellspacing="1" bgcolor="#6EB1F4"><tr><td bgcolor="#FFFFFF" align="center" valign="middle"><img src="/images/loading.gif" align=center>　　系统正在处理中...</td></tr></table></div>
	<div id="wrapper">
    	<h1><a href="#"><span>天翌LVS管理系统</span></a></h1>     
			<?
			  	include "lvsmenu_view.php";
			?>   
                <!-- // #sidebar -->
                
                <!-- h2 stays for breadcrumbs -->
               
                
                <!-- // #main -->
                <div class="clear"></div>
</div>
            <!-- // #container -->
        </div>	
        <!-- // #containerHolder -->
    </div>
    <!-- // #wrapper -->
<table height="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE" class="tables_main">
      <tr>
        <td height="193" align="center">
	<table width="20" border="0" cellpadding="0">
          <tr>
            <td height="4"></td>
          </tr>
        </table>
	<table height="490" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
          <tr>
            <td width="80" height="60" valign="top">
			<?
			include "lvsfunmenu_view.php";
			?>
			</td>
            <td width="1" rowspan="2" align="center" valign="top" bgcolor="#eeeeee"></td>
            <td width="735" rowspan="2" align="center" valign="top">
		<div align="left">
		<table width="98%" height="31" border="0" cellpadding="00" cellspacing="1">
                 <tr>
                   <td width="2">&nbsp;</td>
                 <td width="240" valign="bottom"><a href="/lvs/">LVS管理</a> &raquo; <a href="/lvs/Monitors" class="active">监控管理</a> &raquo; <a href="#" class="active"><?=$formbutton?></a></td>
                 </tr>
                 <tr>
                   <td></td>
                   <td height="1" bgcolor="#EEEEEE"></td>
                 </tr>
               </table>
		<br />
		<div style="position:relative; height:440px; overflow-y:auto">
<table width="98%" height="400" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top">
	<form action="<?=$formaction?>" id="postform" name="postform" method="post">
        <table width="500"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#D5DEDB">
          <tr bgcolor="#D5DEDB" height="34" >
			<td height="25" colspan="2"><strong><?=$formbutton?>监控器</strong></td>
          </tr>
          <tr bgcolor="#F9F9F9" height="34" >
            <td height="20" align="right">监控名称：</td>
            <td width="383"><input name="monitors_name" type="text" id="monitors_name" value="<?php echo empty($this->validation->monitors_name)?$monitors_name:$this->validation->monitors_name;?>"><?php echo empty($this->validation->monitors_name_error)?'':$this->validation->monitors_name_error; ?></td>
          </tr>
          <tr bgcolor="#F9F9F9" height="34" >
            <td height="20" align="right">监控类型：</td>
            <td>
		<select name="monitors_type" id="monitors_type" onchange="SetParename();">
			<option value="HTTP_GET" <?if ($monitors_type=="HTTP_GET") echo "selected"; ?>>HTTP_GET</option>
			<option value="SSL_GET" <?if ($monitors_type=="SSL_GET") echo "selected"; ?>>SSL_GET</option>
			<option value="TCP_CHECK" <?if ($monitors_type=="TCP_CHECK") echo "selected"; ?>>TCP_CHECK</option>
			<option value="SMTP_CHECK" <?if ($monitors_type=="SMTP_CHECK") echo "selected"; ?>>SMTP_CHECK</option>
			<option value="MISC_CHECK" <?if ($monitors_type=="MISC_CHECK") echo "selected"; ?>>MISC_CHECK</option>
		</select>
	    </td>
          </tr>	  
           <tr bgcolor="#F9F9F9" height="34" >
            <td height="20" align="right"><div id=partables1></div></td>
            <td width="383"><input name="monitors_par1" type="text" size="40" id="monitors_par1" value="<?php echo empty($this->validation->monitors_par1)?$monitors_par1:$this->validation->monitors_par1;?>"><?php echo empty($this->validation->monitors_par1_error)?'':$this->validation->monitors_par1_error; ?></td>
          </tr>
          <tr bgcolor="#F9F9F9" height="34" >
            <td height="20" align="right"><div id=partables2></div></td>
            <td width="383"><input name="monitors_par2" type="text" size="40" id="monitors_par2" value="<?php echo empty($this->validation->monitors_par2)?$monitors_par2:$this->validation->monitors_par2;?>"><?php echo empty($this->validation->monitors_par2_error)?'':$this->validation->monitors_par2_error; ?><div id=partables3></div></td>
          </tr>
          <tr align="center" bgcolor="#F6F6F6" height="34" >
            <td height="20" colspan="2"><input type="button" name="Submit" value="<?=$formbutton?>" class="button-css" onClick="javascript:document.postform.submit();">
	    <input type="button" name="back" value="返回" class="button-css" onClick="javascript:window.history.go(-1);">
	    </td>
          </tr>
        </table>
		<input type="hidden" name="ID" value="<?=$ID?>">
 	  </form><br>
	<div id="divform" style="display: none">
	<form  id="digestform" name="digestform" method="post">
        <table width="500"  border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#006699">
          <tr bgcolor="#F9F9F9" height="34" width=20><td align=right>IP：</td><td><input name="ip" type="text" size="30" id="ip">如：192.168.0.100</td></tr>
	  <tr bgcolor="#F9F9F9" height="34" ><td align=right>PATH：</td><td><input name="path" type="text" size="30" id="path">如：/webcheck/check.php</td></tr>
	  <tr bgcolor="#F9F9F9" height="34" ><td colspan="2"><input type="button" value="生成>>" onclick="getdigest()" class="button-css"><div id=digestdiv></div></td></tr>
	</table>
	</form>
	</div>
        <br>
    </td>
  </tr>
</table>
</td></tr></table>
		</div>
		<table width="20" border="0" cellpadding="00">
          <tr>
            <td height="4"></td>
          </tr>
        </table>		
		</td>
      </tr>
    </table>
<br>
</body>
</html>